<?php
/**
 * Created by PhpStorm.
 * User: Admin
 * Date: 2016/11/23
 * Time: 15:36
 */
namespace App\Frontend\Models;

use Phalcon\Mvc\Model;
use App\Library\Common\Common;

class BaseModel extends \Phalcon\Mvc\Model
{
    public function onConstruct() {
        $this->setReadConnectionService('dbSlave');
        $this->setWriteConnectionService('dbMaster');
        $this->setup([
            'notNullValidations' => false
        ]);
        //$this->useDynamicUpdate(true);
    }
    /**
     * 初始化数据表
     */
    public function initialize() {
        // $this->common = new Common();
        // //$this->cookies = $this->getDI()->get('cookies');
        // //$callClassName = get_called_class();
        // $this->setup([
        // 'notNullValidations' => true
        // ]);
        // $this->setup(['notNullValidations' => false,'columnRenaming'=>false]);
        // $this->useDynamicUpdate(true);
        // return $this->setSource(TBPREFIX . strtolower(substr($callClassName, strrpos($callClassName, '\\') + 1)));
    }
}